package com.example.ywj.http;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.example.ywj.http.OKHttps.GetAsyncActivity;
import com.example.ywj.http.OKHttps.GetSyncActivity;
import com.example.ywj.http.OKHttps.OkHttpPostActivity;
import com.example.ywj.http.http.GetActivity;
import com.example.ywj.http.http.Post2Activity;
import com.example.ywj.http.http.postActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class MainActivity extends AppCompatActivity {
    @BindView(R.id.btn_get)
    public Button btn_get;
    @BindView(R.id.btn_post)
    public Button btn_post;
    @BindView(R.id.btn_post_list)
    public Button btn_post2;
    @BindView(R.id.btn_Sync_Get)
    public Button btn_sync_get;
    @BindView(R.id.btn_Async_Get)
    public Button btn_async_get;
    @BindView(R.id.btn_okhttp_post)
    public Button btn_okhttp_post;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
    }
    @OnClick({R.id.btn_get,R.id.btn_post,R.id.btn_post_list,R.id.btn_Sync_Get,R.id.btn_Async_Get,R.id.btn_okhttp_post})
    public void onClickView(View view){
        switch (view.getId()){
            case R.id.btn_get:
                Intent intent = new Intent(MainActivity.this,GetActivity.class);
                startActivity(intent);
                finish();
                break;
            case R.id.btn_post:
                Intent intent1 = new Intent(MainActivity.this,postActivity.class);
                startActivity(intent1);
                finish();
                break;
            case R.id.btn_post_list:
                Intent intent2 = new Intent(MainActivity.this,Post2Activity.class);
                startActivity(intent2);
                finish();
                break;
            case R.id.btn_Sync_Get:
                Intent intent3 = new Intent(MainActivity.this,GetSyncActivity.class);
                startActivity(intent3);
                finish();
                break;
            case R.id.btn_Async_Get:
                Intent intent4 = new Intent(MainActivity.this,GetAsyncActivity.class);
                startActivity(intent4);
                finish();
                break;
            case R.id.btn_okhttp_post:
                Intent intent5 = new Intent(MainActivity.this,OkHttpPostActivity.class);
                startActivity(intent5);
                finish();
                break;
        }
    }
}
